package com.atwisdom.star.common.util;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class JwtTokenMap {
    //AppId,BaseToken
    private static Map<String,Object> registry= Collections.
                                synchronizedMap(new HashMap<>());
    public synchronized static void putToken(String userId,String jwtToken){
        registry.put(userId,jwtToken);
    }

    public synchronized static void removeToken(String userId){
        registry.remove(userId);
    }

    public synchronized static String getToken(String userId){
        return (String) registry.get(userId);
    }

    public synchronized static void putUser(String jwtToken,Object user){
        registry.put(jwtToken,user);
    }

    public synchronized static void removeUser(String jwtToken){
        registry.remove(jwtToken);
    }

    public synchronized static Object getUser(String jwtToken){
        return  registry.get(jwtToken);
    }
}
